--
-- Created by IntelliJ IDEA.
-- User: cay91
-- Date: 2020-11-14
-- Time: 8:25 PM
-- To change this template use File | Settings | File Templates.
--
ngx.header.content_type = "text/plain";

local redis = require "resty.redis"
local red = redis:new()

red:set_timeout(1000)

local ok, err = red:connect("192.168.3.31", 6379)
if not ok then
  ngx.say("failed to connect: ", err)
  return
end

ngx.say("set result: ", ok)

local res, err = red:get("dog")
if not res then
  ngx.say("failed to get doy: ", err)
  return
end

if res == ngx.null then
  ngx.say("dog not found.")
  return
end

ngx.say("dog: ", res)

